#!/usr/bin/python

from world import World

class Character(World):
    def __init__(self, name, age=21, money=0,
                    latitude=1, longitude=2):
        self.name = name
        self.age = age
        self.money = money
        self.position = (latitude, longitude)
    def showCharacter(self):
        for key in sorted(self.__dict__):
            print("%s:\t%s" % (key, getattr(self,key)))

if __name__ == '__main__':
    myworld = World(12)
    bob = Character('Bob Smith', 21, 0, 0, 0)
    sue = Character('Sue Smith', 18, 2500, 1, 1)
    tom = Character('Tom Jones', 28, 11, 1, 0)
    tim = Character('Tim Lilth', 19, 25, 0, 1)
    pos = (0, 0)
    for pos,name,env in (((4,8),'Luoyang','%tR0'), \
                        ((10,11),'Yangzhou','-tC0'), \
                        ((8,2),'Chengdu','^tR0'), \
                        ((4,4),'Changan','#tR0')):
        myworld.namePlace(pos, name)
        myworld.setPlaceEnv(pos, env)

    myworld.addToPlace(tim.position, tim)
    myworld.addToPlace(bob.position, bob)
    myworld.addToPlace(tom.position, tom)
    myworld.addToPlace(sue.position, sue)
    myworld.printMap()
    myworld.moveFromToPlace(sue.position,(5,6),sue)
    myworld.printMap()
